home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Crystal_Re2023131042006.psc / crystal report 10 dynamic datasource / modReport.bas < prev    next >
BASIC Source File  |  2006-10-04  |  685b  |  27 lines

  1. Attribute VB_Name = "modReport"
  2. Option Explicit
  3. Public crApp As New CRAXDRT.Application
  4. Public crRep As CRAXDRT.Report
  5. Public dbTable As CRAXDRT.DatabaseTable
  6. Public strSelect As String
  7.  
  8. Function viewReport(ByVal strSql As String, ByVal strReportFile As String)
  9. Set crRep = New CRAXDRT.Report
  10. Set crApp = CreateObject("crystalruntime.application")
  11. Set crRep = crApp.OpenReport(strReportFile)
  12.  
  13. For Each dbTable In crRep.Database.Tables
  14.  dbTable.SetLogOnInfo "servername", "databasename", "", ""
  15. Next dbTable
  16.  
  17. crRep.SQLQueryString = strSql
  18. Form1.CRViewer1.ReportSource = crRep
  19. Form1.CRViewer1.viewReport
  20.  
  21. Set crRep = Nothing
  22. Set crApp = Nothing
  23.  
  24. End Function
  25.  
  26.  
  27.